package util;

import com.ckeditor.CKEditorConfig;
import com.ckeditor.EventHandler;
import com.ckeditor.GlobalEventHandler;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author WMThiet
 */
public class Configuration {

    public static CKEditorConfig createConfig() {
        CKEditorConfig config = new CKEditorConfig();
        config.addConfigValue("width", "100%");
        config.addConfigValue("uiColor", "#A2A5A6");
        config.addConfigValue("extraPlugins", "autogrow");
        config.addConfigValue("autoGrow_maxHeight", 400);
        config.addConfigValue("removePlugins", "resize");

        return config;
    }
    
    public static CKEditorConfig createConfig(String toolbar,String color,int height) {
        CKEditorConfig config = new CKEditorConfig();
        
        config.addConfigValue("uiColor", color);
        config.addConfigValue("toolbar", toolbar);
        config.addConfigValue("width", "100%");
        config.addConfigValue("height", height);
        config.addConfigValue("removePlugins", "resize");       
        
        return config;
    }

    public static EventHandler createEventHandlers() {
        EventHandler handler = new EventHandler();
        handler.addEventHandler("instanceReady", "function (ev) { alert(\"Loaded: \" + ev.editor.name); }");
        return handler;
    }

    public static GlobalEventHandler createGlobalEventHandlers() {
        GlobalEventHandler handler = new GlobalEventHandler();
        handler.addEventHandler("dialogDefinition", "function (ev) {  alert(\"Loading dialog window: \" + ev.data.name); }");
        return handler;
    }
}
